// 查询数据库的数据，获取到input框
// 编辑 取出数据
localStorage.getItem('data');
localStorage.getItem('editData');

let data = localStorage.getItem('data');
let editData = localStorage.getItem('editData');

let dataone = JSON.parse(data);
let editDataone = JSON.parse(editData);

console.log(data);
console.log(editData);
console.log($('.planId').val(editDataone.plan_id))
$('.planId').val(editDataone.plan_id)
$('select[name="select_option"]').val(editDataone.c_state)
$('.textarea').val(editDataone.c_remark)
$('.planName').val(editDataone.plan_name)
$('.crePerson').val(editDataone.c_crePerson)
$('.creDate').val(editDataone.c_credate)
$('.upDate').val(editDataone.c_update)
$('.creDate').val(editDataone.c_credate)

$('.save_edit').click(() => {
    if (confirm('是否确定修改数据？')) {
        $.ajax({
            url: '/xinchou/edit',
            method: 'post',
            data: {
                plan_id: $('.planId').val(),
                c_state: $('select[name="select_option"]').val(),
                c_remark: $('.textarea').val(),
                plan_name: $('.planName').val(),
                c_crePerson: $('.crePerson').val(),
                c_credate: $('.creDate').val(),
                c_update: $('.upDate').val(),
                c_credate: $('.creDate').val()
            },
            success: (res) => {
                if (res.error) {
                    console.log(res.msg);
                } else {
                    alert('修改成功');
                }
            }
        })
    }
});
// // 重置
$('.reset').click(()=>{
    location.href='../../pages/xinChouFuLi1--QinRong/qiYeXingChouFangAn.html'
    // getData();  
})
